<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>设备巡检报告</title>
    <link rel="stylesheet" href="static/css/style.css">
</head>
<body>
<div class="navbar">
    <a href="index.html" class="active">首页</a>
    <a href="daily_report.html">今日巡检报告</a>
    <a href="device_details.html">设备详细信息</a>
</div>
    <div class="dashboard">
        <h1>设备巡检报告</h1>
        
        <div class="summary-cards">
            <div class="summary-card">
                <span class="count">{{ total_devices }}</span>
                <span class="label">总设备数</span>
            </div>
            <div class="summary-card bg-success">
                <span class="count">{{ online_count }}</span>
                <span class="label">在线设备</span>
            </div>
            <div class="summary-card bg-warning">
                <span class="count">{{ warning_count }}</span>
                <span class="label">警告设备</span>
            </div>
            <div class="summary-card bg-danger">
                <span class="count">{{ offline_count }}</span>
                <span class="label">离线设备</span>
            </div>
        </div>

        <p class="update-time">最后更新时间: {{ today }}</p>

        <div class="table-container">
            <table>
                <thead>
                    <tr>
                        <th>设备名称</th>
                        <th>类型</th>
                        <th>状态</th>
                        <th>最后检查时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {% for device in devices %}
                    <tr>
                        <td>{{ device.name }}</td>
                        <td>{{ "服务器" if device.type == "server" else "网络设备" }}</td>
                        <td>
                            <span class="status-badge status-{{ device.status }}">
                                {% if device.status == "offline" %}离线
                                {% elif device.status == "warning" %}警告
                                {% elif device.status == "unknown" %}未知
                                {% else %}在线{% endif %}
                            </span>
                            {% if device.status_details %}
                            <div class="status-details">
                                {% for detail in device.status_details %}
                                <small>{{ detail }}</small><br>
                                {% endfor %}
                            </div>
                            {% endif %}
                        </td>
                        <td>{{ device.latest_check }}</td>
                        <td>
                            <a href="devices/{{ device.name }}.html" class="btn view-detail">查看详情</a>
                        </td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
    <script src="static/js/scripts.js"></script>
</body>
</html>
